{extend name='admin@main'}

{block name="button"}
<button data-modal='{:url("add")}' data-title="添加奖品" class='layui-btn layui-btn-sm layui-btn-primary'>添加奖品</button>
{if auth("admin/draw/remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" data-csrf="{:systoken('remove')}" class='layui-btn layui-btn-sm layui-btn-primary'>删除奖品</button>
{/if}
{/block}

{block name="content"}
<div class="think-box-shadow">
    <table class="layui-table margin-top-10" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-center nowrap'>标题</th>
            <th class='text-center nowrap'>图片</th>
            <th class='text-center nowrap'>类型</th>
            <th class='text-center nowrap'>中奖概率</th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
            </td>
            <td class='list-table-sort-td'>
                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
            </td>
            <td class='text-center nowrap'>
                {$vo.title_zh_cn|default='--'}
            </td>
            <td class='text-center nowrap'>
                {notempty name='vo.img'}
                <img data-tips-image style="width:50px;height:50px" src="{$vo.img|default=''}" class="margin-right-5 text-top">
                {/notempty}
            </td>
            <td class='text-center nowrap'>
                {if $vo.type == 1}
                <span class="color-green">实物</span><br/>
                {/if}
                {if $vo.type == 2}
                <span class="color-red">现金</span><br/>
                <span class="color-red">现金：{$vo.money}</span>
                {/if}
                {if $vo.type == 3}
                <span class="color-desc">未中奖</span>
                {/if}
            </td>
            <td class='text-center nowrap'>
                {$vo.probability|default='--'}
            </td>
            <td class='text-center nowrap'>
                <div class="nowrap margin-bottom-5">
                    {if auth("admin/draw/edit")}
                    <a data-dbclick class="layui-btn layui-btn-sm" data-open='{:url("edit")}?id={$vo.id}'>编 辑</a>
                    {else}
                    <a data-tips-text="您没有编辑奖品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">编 辑</a>
                    {/if}
                    {if auth("admin/draw/remove")}
                    <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除奖品吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                    {else}
                    <a data-tips-text="您没有删除奖品的权限哦！" class="layui-btn layui-btn-sm layui-btn-primary layui-disabled">删 除</a>
                    {/if}

                </div>

            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>

    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}

</div>
{/block}
